﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _013_字典练习
{
    class Program
    {
        static Dictionary<char, int> dict = new Dictionary<char, int>();
        static void Main(string[] args)
        {
            string str = "welcome to guangzhou gdmec";
            foreach(char c in str.Replace(" "," "))
            {
                if (dict.ContainsKey(c))
                {
                    dict[c]++;
                }
                else
                {
                    dict.Add(c, 1);
                }
            }

            foreach(var key in dict.Keys)
            {
                CountChar(key);
            }
            Console.ReadLine();
        }
        public static void CountChar(char c)
        {
            Console.WriteLine(c + "出现的次数是：" + dict[c]);
        }
    }
}
